<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="node161.html" />
<link rel="prev" href="email-pkg-history.html" />
<link rel="parent" href="module-email.html" />
<link rel="next" href="node161.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>7.1.12 Differences from mimelib</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7.1.11 package History"
  href="email-pkg-history.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="7.1 email  "
  href="module-email.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7.1.13 Examples"
  href="node161.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="email-pkg-history.html">7.1.11 Package History</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-email.html">7.1 email  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node161.html">7.1.13 Examples</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION0091120000000000000000">
7.1.12 Differences from <tt class="module">mimelib</tt></a>
</h2>

<p>
The <tt class="module">email</tt> package was originally prototyped as a separate
library called
<a class="ulink" href="http://mimelib.sf.net/"
  ><tt class="module">mimelib</tt></a>.
Changes have been made so that
method names are more consistent, and some methods or modules have
either been added or removed.  The semantics of some of the methods
have also changed.  For the most part, any functionality available in
<tt class="module">mimelib</tt> is still available in the <tt class="module"><a href="module-email.html">email</a></tt> package,
albeit often in a different way.  Backward compatibility between
the <tt class="module">mimelib</tt> package and the <tt class="module">email</tt> package was not a
priority.

<p>
Here is a brief description of the differences between the
<tt class="module">mimelib</tt> and the <tt class="module"><a href="module-email.html">email</a></tt> packages, along with hints on
how to port your applications.

<p>
Of course, the most visible difference between the two packages is
that the package name has been changed to <tt class="module"><a href="module-email.html">email</a></tt>.  In
addition, the top-level package has the following differences:

<p>

<ul>
<li><tt class="function">messageFromString()</tt> has been renamed to
      <tt class="function">message_from_string()</tt>.

<p>
</li>
<li><tt class="function">messageFromFile()</tt> has been renamed to
      <tt class="function">message_from_file()</tt>.

<p>
</li>
</ul>

<p>
The <tt class="class">Message</tt> class has the following differences:

<p>

<ul>
<li>The method <tt class="method">asString()</tt> was renamed to <tt class="method">as_string()</tt>.

<p>
</li>
<li>The method <tt class="method">ismultipart()</tt> was renamed to
      <tt class="method">is_multipart()</tt>.

<p>
</li>
<li>The <tt class="method">get_payload()</tt> method has grown a <var>decode</var>
      optional argument.

<p>
</li>
<li>The method <tt class="method">getall()</tt> was renamed to <tt class="method">get_all()</tt>.

<p>
</li>
<li>The method <tt class="method">addheader()</tt> was renamed to <tt class="method">add_header()</tt>.

<p>
</li>
<li>The method <tt class="method">gettype()</tt> was renamed to <tt class="method">get_type()</tt>.

<p>
</li>
<li>The method <tt class="method">getmaintype()</tt> was renamed to
      <tt class="method">get_main_type()</tt>.

<p>
</li>
<li>The method <tt class="method">getsubtype()</tt> was renamed to
      <tt class="method">get_subtype()</tt>.

<p>
</li>
<li>The method <tt class="method">getparams()</tt> was renamed to
      <tt class="method">get_params()</tt>.
      Also, whereas <tt class="method">getparams()</tt> returned a list of strings,
      <tt class="method">get_params()</tt> returns a list of 2-tuples, effectively
      the key/value pairs of the parameters, split on the "<tt class="character">=</tt>"
      sign.

<p>
</li>
<li>The method <tt class="method">getparam()</tt> was renamed to <tt class="method">get_param()</tt>.

<p>
</li>
<li>The method <tt class="method">getcharsets()</tt> was renamed to
      <tt class="method">get_charsets()</tt>.

<p>
</li>
<li>The method <tt class="method">getfilename()</tt> was renamed to
      <tt class="method">get_filename()</tt>.

<p>
</li>
<li>The method <tt class="method">getboundary()</tt> was renamed to
      <tt class="method">get_boundary()</tt>.

<p>
</li>
<li>The method <tt class="method">setboundary()</tt> was renamed to
      <tt class="method">set_boundary()</tt>.

<p>
</li>
<li>The method <tt class="method">getdecodedpayload()</tt> was removed.  To get
      similar functionality, pass the value 1 to the <var>decode</var> flag
      of the get_payload() method.

<p>
</li>
<li>The method <tt class="method">getpayloadastext()</tt> was removed.  Similar
      functionality
      is supported by the <tt class="class">DecodedGenerator</tt> class in the
      <tt class="module"><a href="module-email.generator.html">email.generator</a></tt> module.

<p>
</li>
<li>The method <tt class="method">getbodyastext()</tt> was removed.  You can get
      similar functionality by creating an iterator with
      <tt class="function">typed_subpart_iterator()</tt> in the
      <tt class="module"><a href="module-email.iterators.html">email.iterators</a></tt> module.
</li>
</ul>

<p>
The <tt class="class">Parser</tt> class has no differences in its public interface.
It does have some additional smarts to recognize
<span class="mimetype">message/delivery-status</span> type messages, which it represents as
a <tt class="class">Message</tt> instance containing separate <tt class="class">Message</tt>
subparts for each header block in the delivery status
notification<a name="tex2html74"
  href="#foot22165"><sup>7.4</sup></a>.

<p>
The <tt class="class">Generator</tt> class has no differences in its public
interface.  There is a new class in the <tt class="module"><a href="module-email.generator.html">email.generator</a></tt>
module though, called <tt class="class">DecodedGenerator</tt> which provides most of
the functionality previously available in the
<tt class="method">Message.getpayloadastext()</tt> method.

<p>
The following modules and classes have been changed:

<p>

<ul>
<li>The <tt class="class">MIMEBase</tt> class constructor arguments <var>_major</var>
      and <var>_minor</var> have changed to <var>_maintype</var> and
      <var>_subtype</var> respectively.

<p>
</li>
<li>The <code>Image</code> class/module has been renamed to
      <code>MIMEImage</code>.  The <var>_minor</var> argument has been renamed to
      <var>_subtype</var>.

<p>
</li>
<li>The <code>Text</code> class/module has been renamed to
      <code>MIMEText</code>.  The <var>_minor</var> argument has been renamed to
      <var>_subtype</var>.

<p>
</li>
<li>The <code>MessageRFC822</code> class/module has been renamed to
      <code>MIMEMessage</code>.  Note that an earlier version of
      <tt class="module">mimelib</tt> called this class/module <code>RFC822</code>, but
      that clashed with the Python standard library module
      <tt class="module"><a href="module-rfc822.html">rfc822</a></tt> on some case-insensitive file systems.

<p>
Also, the <tt class="class">MIMEMessage</tt> class now represents any kind of
      MIME message with main type <span class="mimetype">message</span>.  It takes an
      optional argument <var>_subtype</var> which is used to set the MIME
      subtype.  <var>_subtype</var> defaults to <span class="mimetype">rfc822</span>.
</li>
</ul>

<p>
<tt class="module">mimelib</tt> provided some utility functions in its
<tt class="module">address</tt> and <tt class="module">date</tt> modules.  All of these functions
have been moved to the <tt class="module"><a href="module-email.utils.html">email.utils</a></tt> module.

<p>
The <code>MsgReader</code> class/module has been removed.  Its functionality
is most closely supported in the <tt class="function">body_line_iterator()</tt>
function in the <tt class="module"><a href="module-email.iterators.html">email.iterators</a></tt> module.

<p>
<br><hr><h4>Footnotes</h4>
<dl>
<dt><a name="foot22165">...
notification</a><A
 HREF="node160.html#tex2html74"><sup>7.4</sup></a></dt>
<dd>Delivery Status Notifications (DSN) are defined
in <a class="rfc" id='rfcref-99424' xml:id='rfcref-99424'
href="http://www.faqs.org/rfcs/rfc1894.html">RFC 1894</a>.

</dd>
</dl>
<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7.1.11 package History"
  href="email-pkg-history.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="7.1 email  "
  href="module-email.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7.1.13 Examples"
  href="node161.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="email-pkg-history.html">7.1.11 Package History</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-email.html">7.1 email  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node161.html">7.1.13 Examples</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
